<template>
    <div class="download">
        <van-overlay :show="show" @click="show = false">
            <div class="wrapper" @click.stop>
                <img src="@/assets/img/download/bk.png" alt="">
            </div>
        </van-overlay>
        <div class="download_btn">
            <van-button block type="primary" class="btn1" @click="onSubmit"> 立即下载 </van-button>
        </div>
    </div>
</template>

<script>
import { onMounted, reactive, ref, toRefs } from 'vue'
import { Toast, Notify } from 'vant';
import { useStore } from "vuex"; // ⚪️ 引入状态管理
import router from "../../router";
export default {
    setup() {
        const store = useStore(); // 获取对象
        const state = reactive({
            show: false
        });
        onMounted(() => {
            //是否是微信浏览器
            if (/(micromessenger)/i.test(navigator.userAgent)) {
                //是否电脑微信或者微信开发者工具
                if (/(WindowsWechat)/i.test(navigator.userAgent) || /(wechatdevtools)/i.test(navigator.userAgent)) {
                    // alert('电脑微信或者微信开发者工具')
                } else {
                    state.show = true
                    //手机微信打开的浏览器
                    // alert('手机微信')
                }
            } else {
                // alert('其他浏览器')
            }
            // if (navigator.userAgent.toLowerCase().indexOf('micromessenger') !== -1) {
            //     state.show = true;
            // }
        });
        const onClickLeft = () => {
            router.push({ path: "/my" });
        };
        const onSubmit = () => {
            window.location.href = 'http://119.45.149.156:2027/%E9%87%91%E8%8C%B6%E5%AE%9D-releaseProduct-V1.0.0.apk';
        };
        return {
            ...toRefs(state),
            onClickLeft,
            onSubmit,
        };
    },
};
</script>

<style scoped></style>